'python传递不可变实例,通过ID（）来查看内存地址'


def change(a):
    print(id(a))
    a = 10
    print(id(a))


"""传递可变对象"""


def changeme(mylist):
    mylist.append([1, 2, 3, 4])
    print("函数内取值", mylist)
    return


"""不定长参数,以tuple格式传入*"""


def printInfo(arg1, *vartuple):
    print(arg1)
    for value in vartuple:
        print(value)


"""不定长参数,以字典格式传入**"""


def printInfo1(arg1, **vardict):
    print(arg1)
    print(vardict)


"""*可以单独出现,如果单独出现星号 * 后的参数必须用关键字传入。"""


def f(a, b, *, c):
    return a + b + c


"""匿名函数"""
sum = lambda arg1, arg2: arg1 * arg2

if __name__ == '__main__':
    # a=1
    # print(id(a))
    # change(a)
    # mylist = [10, 20, 30]
    # changeme(mylist)
    # print("函数外取值", mylist)
    # printInfo(10, 20, 30)
    # printInfo1(10, a='20', c='30')
    # print(f(1, 2, c=3))
    print(sum(2, 3))
